<%--
  Created by IntelliJ IDEA.
  User: 86136
  Date: 2021/12/26
  Time: 1:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<style>
    #grad1 {
        height: 1200px;
        width:1200px;
        background-color: red; /* 浏览器不支持时显示 */
        background-image: linear-gradient(#e66465, #9198e5);
    }
    .center{
        　　text-align:center;
    }
</style>
<head>
    <title>用户登录</title>
</head>
<body>
<div style="text-align: center">
    <div id="grad1">
        <p style="left:10px">
            欢迎进入电子商务网站登录系统</p>
    <form action="/login" method="'post" id="loginform">
        姓名：<input type="text" name="uname" id="uname" value="${messageModel.object.username}"> <br>
        密码：<input type="password" name="upwd" id="upwd" value="${messageModel.object.userpwd}"> <br>
        <span id="msg" style="font-size: 12px;color: red">${messageModel.msg}</span> <br>
        <button type="button" id="loginBtn">登录</button>
        <button type="button">注册</button>
    </form>
    </div>
</div>
</body>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>

<script type="text/javascript">
    $("#loginBtn").click(function () {

        var uname = $("#uname").val();
        var upwd = $("#upwd").val();
        if(isEmpty(uname)){
            $("#msg").html("用户姓名不可为空！");
            return;
        }
        if(isEmpty(upwd)){
            $("#msg").html("密码不可为空！");
            return;
        }
        $("#loginform").submit();
    });

    function isEmpty(str){
        if(str == null || str.trim() == ""){
            return true;
        }
        return false;
    }
</script>
</html>
